using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class AudioManager : MonoBehaviour
{   
    [SerializeField]private AudioSource musicSource;
    [SerializeField]private AudioSource sfxSource;
    [SerializeField]private AudioClip[] sfxClips;
    public static AudioManager instance;
    // Start is called before the first frame update

    private void Awake()
    {
        if(instance!=null)
        {
            Destroy(gameObject);
            return;
        }
        instance = this;
    }

    void Start()
    {
       if(musicSource!=null)
        {
            musicSource.volume = DataManager.instance.musicSetting;
        }
        if(sfxSource!=null)
        {
            sfxSource.volume = DataManager.instance.sfxSetting;
        } 
    }
    
    public void PlayMusic(int i)
    {
        sfxSource.PlayOneShot(sfxClips[i]);
    }

    
}
